package cn.task.tool;

import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * 提供给ai的工具包
 @author Mengru Jiao
 @date 2025/5/29
 @project java-ai-langchain4j
 */
@Component
public class CalculatorTools {
    @Tool
    double sum(@ToolMemoryId int memoryId, double a, double b) {
        System.out.println("调用加法运算"+memoryId);
        return a + b;
    }
    @Tool
    double squareRoot(@ToolMemoryId int memoryId, double x) {
        System.out.println("调用平方根运算"+memoryId);
        return Math.sqrt(x);
    }
}
